package com.neuedu.service.impl;

import com.github.pagehelper.PageHelper;
import com.neuedu.bean.User;
import com.neuedu.bean.VO.UserVO;
import com.neuedu.mapper.UserMapper;
import com.neuedu.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private UserMapper userMapper;

    @Override
    public User getUserById(String userId) throws Exception {
        return userMapper.getUserById(userId);
    }

    @Override
    public int saveUser(User user) throws Exception {

        return userMapper.saveUser(user);
    }

    /*
    *  登录
    * */
    @Override
    public User getUserByIdByPass(String userId, String password) throws Exception {
        return userMapper.getUserByIdByPass(userId, password);
    }

    @Override
    public List<User> queryUserPageList(int pageNum, int pageSize, UserVO userVO) {
        PageHelper.startPage(pageNum, pageSize);
        List<User> userList = userMapper.queryUserPageList(userVO);
        return userList;
    }
}
